<!DOCTYPE HTML5>
<html>
<%@ include file="/jsp/common.jsp" %>
<%@ page  language="java" import="java.util.*" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<head>
<link rel="shortcut icon" href="img/xuejiadmin.jpg"/> 
<link href="css/mainbody_style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.4.4.js"></script>
</head>
<body>
	<div class="topClass">
		<h1 align="center">
			学籍管理系统
		</h1>
		<h2 align="left">
			&nbsp;&nbsp;
			<c:forEach items="${menuLists}" var="menu" >
				<a class="a_levelOne" onclick="showSecondMenu('<c:out value="${menu.position}"/>')" href="javascript:void(0);">
					<c:out value="${menu.describ}"/>
				</a>
			</c:forEach>
		</h2>
	</div>
	<div>
		<div id="leftClass" class="leftClass">
			<c:forEach items="${secondMenuLists}" var="secondMenu" >
				<a class="a_levelTwo" href='<c:out value="${secondMenu.menuUrl}"/>' id="<c:out value='${secondMenu.position}'/>"
				onclick="showThirdMenu('<c:out value="${secondMenu.position}"/>')" target="mainContent">
					<c:out value="${secondMenu.describ}"/>
				</a>
			</c:forEach>
		</div>
		
		<div class="mainClass" >
			<iframe id="mainContent" name="mainContent" width="100%" height="100%" 
			style="border:none;scrolling:none;" src="jsp/mainContent.jsp"></iframe>
		</div>
	</div>
	
	<div class="bottomClass" style="margin:0px;padding-top:3px;text-align:center;">
		版权所有，请勿抄袭，否则侵权必究！
	</div>
	
<script>
//一级菜单查询展示二级菜单
function showSecondMenu(position){
	$.ajax({
		url:"commonAjax.do",
		type:"POST",
		data: {
			"sql":"users.ajaxQuerySecondMenuLists",
			"position":position
		},
		async:false,
		dataType:"json",
		success:function(data){
			var resuleCode = data["result"];
			if(resuleCode=="0") return;
			var resList = data["resList"];
			if(resList || resList.length>0){
				document.getElementById("leftClass").innerHTML = "";
				for(var i=0;i<resList.length;i++){
					var a = document.createElement("a");
					a.className = "a_levelTwo";
					a.href = resList[i]["column03"];
					a.text = resList[i]["column01"];
					a.id = resList[i]["column02"] ;
					a.setAttribute("onclick","showThirdMenu('"+resList[i]["column02"]+"');");
					a.target = "mainContent";
					document.getElementById("leftClass").appendChild(a);
				}
			}
		},
		error:function(data){
			alert("查询处理异常");
			console.log("处理失败了");
		}
	});
	$("#mainContent").attr("src","jsp/mainContent.jsp");
}

//二级菜单查询展示三级菜单
function showThirdMenu(position){
	$.ajax({
		url:"commonAjax.do",
		type:"POST",
		data: {
			"sql":"users.ajaxQuerySecondMenuLists",
			"position":position
		},
		async:false,
		dataType:"json",
		success:function(data){
			var resuleCode = data["result"];
			if(resuleCode=="0") return;
			var resList = data["resList"];
			if(resList || resList.length>0){
				if($.find(".a_levelThree")){
					$("a").remove(".a_levelThree");
				};
				for(var i=0;i<resList.length;i++){
					var a = document.createElement("a");
					a.className = "a_levelThree";
					a.href = resList[i]["column03"]+"?position="+resList[i]["column02"];
					a.text = resList[i]["column01"];
					a.target = "mainContent";
					$("#"+position).after(a);
				}
			}
		},
		error:function(data){
			alert("查询处理异常");
			console.log("处理失败了");
		}
	});
	$("#mainContent").attr("src","jsp/mainContent.jsp");
}

</script>
</body>